package com.ruoyi.common.enums;

import com.ruoyi.common.utils.StringUtils;

import java.util.HashSet;
import java.util.Set;

/**
 *  产品类型枚举类
 *
 * @author yinjc
 */
public enum MaterialTypeEnum {

    /** 半导体产品类型枚举类 */
    IGBT("IGBT", "IGBT")
    , SIC("SIC", "OTHER")
    , FRD("FRD", "FRD")
    , SBD("SBD", "SBD")
    , VDMOS("VDMOS", "VDMOS")
    , NIPT60("SBD-NIPT60", "SBD")
    , NIPT15("SBD-NIPT15", "SBD")
    , TrenchSBD("Trench SBD", "TMBS")
    ;

    private final String materialType;
    private final String materialTypeBelong;

    private MaterialTypeEnum(String materialType, String materialTypeBelong) {
        this.materialType = materialType;
        this.materialTypeBelong = materialTypeBelong;
    }

    public String getMaterialType() {
        return materialType;
    }

    public String getMaterialTypeBelong() {
        return materialTypeBelong;
    }

    /**
     * 根据传入的mes产品类型获取到实际的产品类型
     * @param materialType
     * @return
     */
    public static String getPartTypeByMaterialType(String materialType) {
        for (MaterialTypeEnum materialTypeEnum : values()) {
            if (StringUtils.equals(materialType, materialTypeEnum.materialType)) {
                return materialTypeEnum.materialTypeBelong;
            }
        }
        return null;
    }

    /**
     * 获取实际的产品类型的集合
     * @return
     */
    public static Set<String> getDisPartType() {
        Set<String> disPartType = new HashSet<>();
        for (MaterialTypeEnum materialTypeEnum : values()) {
            disPartType.add(materialTypeEnum.getMaterialTypeBelong());
        }
        return disPartType;
    }
}
